function boffscreen = IsOffScreen(exs, eys, imgx, imgy, nprevobjs, noffbuffer)

boffscreen = 0;


for i = nprevobjs
    
    if exs(i) > 0 && eys(i) > 0    
        if exs(i) < noffbuffer
            boffscreen = 1;
        end

        if exs(i) > (imgx-noffbuffer)
            boffscreen = 1;
        end


        if eys(i) < noffbuffer
            boffscreen = 1;
        end

        if eys(i) > (imgy-noffbuffer)
            boffscreen = 1;
        end
    end
end